package dataStructure;

import java.util.ArrayDeque;
import java.util.Deque;
import java.util.LinkedList;

public class StackDemo {
    public static void main(String[] args) {
        Deque<Integer> stack = new ArrayDeque<>();
        stack.push(1); // 压入栈
        stack.offer(2); //
        Integer i = stack.pop(); // 弹出栈顶元素
        System.out.println(i);
        Integer j = stack.peek(); // 取栈顶元素，不弹出
        System.out.println(j);
        Integer k = stack.poll(); // 弹出栈顶元素
        System.out.println(k);
        boolean isEmpty = stack.isEmpty(); // 判断是否为空
        System.out.println(isEmpty);
    }
}
